package com.sxfq.loansupermarket.backsystem.modular.base;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsResponse;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.sxfq.loansupermarket.backsystem.core.shiro.ShiroKit;
import com.sxfq.loansupermarket.backsystem.core.support.DateTimeKit;
import com.sxfq.loansupermarket.backsystem.core.util.StringUtil;
import com.sxfq.loansupermarket.backsystem.modular.IntegralMall.entity.MembersUser;
import com.sxfq.loansupermarket.backsystem.modular.IntegralMall.entity.iconInfoStatus;
import com.sxfq.loansupermarket.backsystem.modular.arrival.entity.CustomerInfo;
import com.sxfq.loansupermarket.backsystem.modular.doctorLooked.entity.CaseInfo;
import com.sxfq.loansupermarket.backsystem.modular.logsf.entity.ReservationsSecondLogInfo;
import com.sxfq.loansupermarket.backsystem.modular.marketing.entity.ApprovalProcessInfo;
import com.sxfq.loansupermarket.backsystem.modular.marketing.entity.ReservationsInfo;
import com.sxfq.loansupermarket.backsystem.modular.marketing.service.IReservationsService;
import com.sxfq.loansupermarket.backsystem.modular.refunds.entity.RechargeInfo;
import com.sxfq.loansupermarket.backsystem.modular.weixin.service.IWxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Random;

@Component
@Configuration
@EnableScheduling
public class SaticScheduleTask {
    @Autowired
    private SqlMapper sqlMapper;
    @Autowired
    private IWxService wxService;

    @Autowired
    IReservationsService reservationsService;

    /**
     * 定时任务发送短信
     */
//    @Scheduled(cron = "0 0 10 * * ?")
//    public  void   msgSendAotu() throws ClientException, InterruptedException {
//        //恩施区域查询门店
//        String nameSql = "select id, simplename, fullname,area_abbreviation,abbreviation from dept where tips=1 and (area_abbreviation='yiya_essj_' or area_abbreviation='yiya_esxj_') order by num desc;";
//        List<Dept> dimensionList = sqlMapper.selectList(nameSql, Dept.class);
//        String times = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
//        String time = times.substring(5,10);
//        for (Dept info : dimensionList) {
//            String table = info.getAbbreviation() + "customer_info";
//            String selectSql = "select id,birthday,arrival_store as arrivalStore,customer_name as customerName,customer_phone as customerPhone from " + table + " where birthday like'%-" + time + "' group by customerPhone ; ";
//            List<CustomerInfo> birInfoList = sqlMapper.selectList(selectSql, CustomerInfo.class);
//            String phoneNumbers ="";
//            String customerName ="";
//            String outpatientName="";
//            String templateCode = "SMS_151575670";
//            String signName = "咿呀口腔" + info.getSimplename();
//            if(birInfoList.size()>0){
//                for (CustomerInfo infos : birInfoList) {
//                    phoneNumbers = infos.getCustomerPhone();
//                    customerName = infos.getCustomerName();
//                    outpatientName = info.getSimplename();
//                    try {
//                        if(phoneNumbers != null){
//                            phoneNumbers = phoneNumbers.substring(0, 11);
//                        }else{
//                            continue;
//                        }
//                        if(customerName == null){
//                            customerName ="客户";
//                        }else{
//                            customerName = infos.getCustomerName();
//                        }
//                    } catch (StringIndexOutOfBoundsException e) {
//                        continue;
//                    }
//                    String messageContent = "尊敬的"+infos.getCustomerName()+"，在这个属于你的精彩日子里,祝你生日快乐,工作顺利!愿你好上加好,福中更福! 咿呀口腔"+outpatientName+"。";
//                    SendSmsRequest request = new SendSmsRequest();
//                    request.setPhoneNumbers(phoneNumbers);
//                    request.setSignName(signName);
//                    request.setTemplateCode(templateCode);
//                    request.setTemplateParam("{\"outpatientName\":\"" + outpatientName + "\",\"customerName\":\"" + customerName + "\"} ");
//                    request.setOutId("123");
//                    SendSmsResponse response = sendSms(request);
//                    System.out.println("短信接口返回的数据----------------");
//                    System.out.println("Code=" + response.getCode());
//                    System.out.println("Message=" + response.getMessage());
//                    System.out.println("RequestId=" + response.getRequestId());
//                    System.out.println("BizId=" + response.getBizId());
//                    Thread.sleep(300L);
//                    //查明细
//                    if (response.getCode() != null && response.getCode().equals("OK")) {
//                        QuerySendDetailsResponse querySendDetailsResponse = querySendDetails(response.getBizId());
//                        System.out.println("短信明细查询接口返回数据----------------");
//                        System.out.println("Code=" + querySendDetailsResponse.getCode());
//                        System.out.println("Message=" + querySendDetailsResponse.getMessage());
//                        System.out.println("TotalCount=" + querySendDetailsResponse.getTotalCount());
//                        System.out.println("RequestId=" + querySendDetailsResponse.getRequestId());
//                        String insertsql = "INSERT INTO `msg_send_info` ( `sender`, `customer_name`, `customer_phone`, `message_content`, `outpatient_name`, `is_success`) VALUES" +
//                                "('系统', '" + infos.getCustomerName() + "', '" + infos.getCustomerPhone() + "', '" + messageContent + "','" + infos.getArrivalStore() + "',1);";
//                        sqlMapper.insert(insertsql);
//                    } else {
//                        String insertsql = "INSERT INTO `msg_send_info` ( `sender`, `customer_name`, `customer_phone`, `message_content`,`outpatient_name`, `is_success`) VALUES" +
//                                "('系统', '" + infos.getCustomerName() + "', '" + infos.getCustomerPhone() + "', '" + messageContent + "','" + infos.getArrivalStore() + "',2);";
//                         sqlMapper.insert(insertsql);
//                    }
//                }
//            }else{
//                continue;
//            }
//        }
//    }

    /**
     * 二次开发 保护期满一年之后渠道自动变为直接上门  定时任务
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void updateChanelAotu() throws Exception{
        //查询一级渠道为二次开发的
        String selSql = "select id,one_channel from reservations_info where one_channel='二次开发'";
        List<ApprovalProcessInfo> infoList = sqlMapper.selectList(selSql,ApprovalProcessInfo.class);
        if(infoList.size()>0){
            for(int i=0;i<infoList.size();i++){
                //查询预约患者信息
                ReservationsInfo reservationsInfo = reservationsService.selectOneById2(infoList.get(0).getId());
                //通过预约ID 查询到过哪些店有消费
                String abbreviationSql = "select abbreviation from distinction_customer_status where reservations_id = '" + infoList.get(i).getId() + "' ";
                List<String> abbreviationList = sqlMapper.selectList(abbreviationSql, String.class);
                String rechargeTables = "";
                if(abbreviationList.size()>0){
                    for (int j = 0; j < abbreviationList.size(); j++) {
                        String head = abbreviationList.get(j);
                        if (j == abbreviationList.size() - 1) {
                            rechargeTables += "select a.id,a.operation_time,a.recharge_time,a.reservations_id,t2.time as time from " + head + "recharge_info a LEFT JOIN reservations_second_development t2  " +
                                    "on a.reservations_id = t2.reservations_id where DATEDIFF(a.recharge_time,t2.time)>0 and a.reservations_id='" + infoList.get(i).getId() + "' ";
                        } else {
                            rechargeTables += "select a.id,a.operation_time,a.recharge_time,a.reservations_id,t2.time as time from " + head + "recharge_info a LEFT JOIN reservations_second_development t2 " +
                                    "on a.reservations_id = t2.reservations_id where DATEDIFF(a.recharge_time,t2.time)>0 and a.reservations_id='" + infoList.get(i).getId() + "' union ";
                        }
                    }
                }
                String custimeSql = "select t1.id as id,t1.reservations_id as reservationsId, t1.recharge_time as rechargeTime,left(t1.operation_time,19) as operationTime, t1.time " +
                        "from (" + rechargeTables + ") t1 where  t1.reservations_id = '" + infoList.get(i).getId() + "' group by t1.recharge_time order by t1.recharge_time asc limit 1";
                RechargeInfo info = sqlMapper.selectOne(custimeSql,RechargeInfo.class);
                if(info!=null){
                    DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                    //第一次结账时间
                    LocalDateTime firstDateTime = LocalDateTime.parse(info.getRechargeTime(), df);
                    Long milliLastTime = firstDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
                    //保护期一年的时间戳
                    Long thTime = 31536000000L;
                    Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
                    //如果满一年 就将渠道变为直接上门
                    if((milliSecond.longValue()-milliLastTime.longValue())>thTime.longValue()){
                        //修改渠道表
                        String updateSql = "update reservations_info a set a.one_channel='直接上门',a.two_channel='直接上门',a.thr_channel='直接上门',a.one_medium='直接上门',a.two_medium='直接上门',a.thr_medium='直接上门' where id='"+infoList.get(i).getId()+"'";
                        sqlMapper.update(updateSql);
                        String updateSqlsc = "update reservations_infosc a set a.one_channel='直接上门',a.two_channel='直接上门',a.thr_channel='直接上门',a.one_medium='直接上门',a.two_medium='直接上门',a.thr_medium='直接上门' where id='"+infoList.get(i).getId()+"'";
                        sqlMapper.update(updateSqlsc);
                        //修改到店表
                        for (int k = 0; k < abbreviationList.size(); k++) {
                            String arrSql = "update "+abbreviationList.get(k)+"customer_info a set a.one_channel='直接上门',a.two_channel='直接上门',a.thr_channel='直接上门',a.one_medium='直接上门'," +
                                    "a.two_medium='直接上门',a.thr_medium='直接上门' where reservations_id='"+infoList.get(i).getId()+"' ";
                            sqlMapper.update(arrSql);
                        }
                        String selectSql ="select * from reservations_second_development where reservations_id='"+reservationsInfo.getId()+"'";
                        ReservationsSecondLogInfo infos = sqlMapper.selectOne(selectSql,ReservationsSecondLogInfo.class);
                        //插入日志表
                        String name="";
                        String follower="";
                        String belonger="";
                        String oneChannel="";
                        String twoChannel="";
                        String thrChannel="";
                        if (StringUtil.isNotEmpty(infos.getName())) {
                            name = "'" + infos.getName()+ "'";
                        } else {
                            name = "null";
                        }
                        if (StringUtil.isNotEmpty(infos.getFollower())) {
                            follower = "'" + infos.getFollower()+ "'";
                        } else {
                            follower = "null";
                        }
                        if (StringUtil.isNotEmpty(infos.getBelonger())) {
                            belonger = "'" + infos.getBelonger()+ "'";
                        } else {
                            belonger = "null";
                        }
                        if (StringUtil.isNotEmpty(infos.getOneChannel())) {
                            oneChannel = "'" + infos.getOneChannel()+ "'";
                        } else {
                            oneChannel = "null";
                        }
                        if (StringUtil.isNotEmpty(infos.getTwoChannel())) {
                            twoChannel = "'" + infos.getTwoChannel()+ "'";
                        } else {
                            twoChannel = "null";
                        }
                        if (StringUtil.isNotEmpty(infos.getThrChannel())) {
                            thrChannel = "'" + infos.getThrChannel()+ "'";
                        } else {
                            thrChannel = "null";
                        }
                        String sq11 = "INSERT INTO reservations_second_log(customer_name,customer_phone,reservations_id,createtime, succeed ,single_person,one_channel,two_channel," +
                                "thr_channel,new_one_channel,new_two_channel,new_thr_channel,archiving,follower,belonger,classname) VALUES " +
                                " ('" +reservationsInfo.getCustomerName() + "','" + reservationsInfo.getCustomerPhone() + "','" + reservationsInfo.getId() + "','" + DateTimeKit.now() + "','成功'," +
                                "'系统',"+oneChannel+","+twoChannel+","+thrChannel+",'直接上门','直接上门','直接上门'," +
                                ""+name+","+follower+","+belonger+",'系统在"+DateTimeKit.now()+"将患者"+reservationsInfo.getCustomerName()+"渠道修改为直接上门');";
                        sqlMapper.insert(sq11);
                        //删除二次开发数据，以便再起发起
                        String delSql = "delete  from reservations_second_development where reservations_id='"+infoList.get(i).getId()+"' ";
                        sqlMapper.delete(delSql);
                    }
                }
            }
        }
    }

    //公众号问卷调查推送 每天19:00 执行
//    @Scheduled(cron = "0 0 17 * * ?")
//    public void questionnaire() {
//        String sql = "select a.*,DATE_ADD(update_time, INTERVAL 7 DAY) as timeTwo from case_info a where statusic=2 " +
//                " and left(now(),10)= left(DATE_ADD(update_time, INTERVAL 7 DAY),10) ";  //医生点了已完成，七天后发送问卷
//        List<iconInfoStatus> ist = sqlMapper.selectList(sql, iconInfoStatus.class);
//        for (iconInfoStatus it : ist) {
//            String selsql2 = "select open_id from members_user where reservations_id='" + it.getReservationsId() + "' and (open_id!='' or open_id is not null) limit 1";
//            MembersUser membersUser = sqlMapper.selectOne(selsql2, MembersUser.class);
//            if (membersUser != null ) {
//                wxService.sendQuestionnaire(membersUser.getOpenId(), it.getId());
//                String upd2 = "update case_info a set statusic=3 where id='" + it.getId() + "'";  //发送完成修改状态为已发送
//                sqlMapper.update(upd2);
//            }
//        }
//        String sql2 = "select a.*,DATE_ADD(update_time, INTERVAL 7 DAY) as timeTwo from case_info a where statusic=1 " +
//                " and left(now(),10)= left(DATE_ADD(update_time, INTERVAL 7 DAY),10) "; //未完成的
//        List<iconInfoStatus> ist2 = sqlMapper.selectList(sql2, iconInfoStatus.class);
//        for (iconInfoStatus it2 : ist2) {
//            String sql1 = "select b.department from case_info a left join pay_service_grade_info b on a.pay_service_id=b.id" +
//                    " where a.id='" + it2.getId() + "'";
//            CaseInfo caseinfo = sqlMapper.selectOne(sql1, CaseInfo.class);
//            if (("正畸".equals(caseinfo.getDepartment()) || "种植牙".equals(caseinfo.getDepartment()) || "儿牙-正畸".equals(caseinfo.getDepartment()))) {  //做的正畸或者种植
//                String selsql2 = "select open_id from members_user where reservations_id='" + it2.getReservationsId() + "' and (open_id!='' or open_id is not null) limit 1";
//                MembersUser membersUser = sqlMapper.selectOne(selsql2, MembersUser.class);
//                if (membersUser != null ) {
//                    wxService.sendQuestionnaire(membersUser.getOpenId(), it2.getId());
//                    String upd2 = "update case_info a set statusic=3 where id='" + it2.getId() + "'";  //发送完成修改状态为已发送
//                    sqlMapper.update(upd2);
//                }
//            }
//        }
//    }

    //参与12月种植返现活动 每月1号的19:10 执行
    @Scheduled(cron = "0 10 19 1 * ?")
    public void activity() throws ClientException, InterruptedException {
        String time = DateTimeKit.now();
        String sql11 = "select * from reservemoney_activity limit 1";
        CustomerInfo a = sqlMapper.selectOne(sql11, CustomerInfo.class);
        if ("01".equals(time.substring(8, 10)) && "2020".equals(time.substring(0, 4)) && !(time.substring(5, 7)).equals(a.getStatuss())) {  //20年每月的1号
            String sql2r = " INSERT INTO reserveMoney_deal (`status`, `reservations_id`, `customer_id`," +
                    "  `recharge_people`,`checkout_method_id`, `checkout_method`, " +
                    "  `actual_account_balance`, `recharge_time`, `operation_time`, " +
                    "  `remarks`, `is_record`,tc_name,add_store,mode,deal_id)    " +
                    " select status,reservations_id,customer_id, " +
                    " recharge_people,checkout_method_id,checkout_method,ROUND(actual_account_balance/12,1),recharge_time,operation_time, " +
                    " remarks,is_record,tc_name,add_store,mode,deal_id from reservemoney_activity ";
            sqlMapper.insert(sql2r);
            String sql = "select * from reservemoney_activity ";
            List<CustomerInfo> dept = sqlMapper.selectList(sql, CustomerInfo.class);
            for (CustomerInfo d : dept) {
                String tableNamer = d.getAbbreviation() + "recharge_info";
                Random rand = new Random();
                int randomNumber = rand.nextInt(999999);
                String id = randomNumber + d.getRechargeTime() + d.getId();
                String sql2 = " INSERT INTO `" + tableNamer + "` (`id`, `status`, `customer_id`, `reservations_id`, " +
                        "  `recharge_people`,`checkout_method_id`, `checkout_method`, " +
                        "  `actual_account_balance`, `recharge_time`, `operation_time`, " +
                        "  `remarks`, `is_record`,tc_name,isEarnes,hospital_performance,section_performance)   " +
                        " select '" + id + "',1,customer_id,reservations_id,recharge_people,checkout_method_id,checkout_method," +
                        "  ROUND(actual_account_balance/12,1),recharge_time,operation_time, " +
                        "  remarks,'是',tc_name,2,ROUND(actual_account_balance/12,1),0" +
                        " from reservemoney_activity where abbreviation='" + d.getAbbreviation() + "' and recharge_time='" + d.getRechargeTime() + "'";
                sqlMapper.insert(sql2);
                String sql1 = "select * from " + d.getAbbreviation() + "customer_info" + " where reservations_id='" + d.getReservationsId() + "' limit 0,1";
                CustomerInfo cu = sqlMapper.selectOne(sql1, CustomerInfo.class);
                String signName = "咿呀口腔" + d.getAddStore();
                String phoneNumbers = cu.getCustomerPhone();
                //String TemplateParam = "";
                //组装请求对象-具体描述见控制台-文档部分内容
                SendSmsRequest request = new SendSmsRequest();
                //必填:待发送手机号
                request.setPhoneNumbers(phoneNumbers);
                //必填:短信签名-可在短信控制台中找到
                request.setSignName(signName);
                //必填:短信模板-可在短信控制台中找到
                request.setTemplateCode("SMS_180353075");
                //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
                //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
                //request.setSmsUpExtendCode("90997");
                //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
                request.setOutId("123");
                //发短信
                SendSmsResponse response = sendSms(request);
                System.out.println("短信接口返回的数据----------------");
                System.out.println("Code=" + response.getCode());
                System.out.println("Message=" + response.getMessage());
                System.out.println("RequestId=" + response.getRequestId());
                System.out.println("BizId=" + response.getBizId());
                Thread.sleep(300L);
                //查明细
                if (response.getCode() != null && response.getCode().equals("OK")) {
                    QuerySendDetailsResponse querySendDetailsResponse = querySendDetails(response.getBizId());
                    System.out.println("短信明细查询接口返回数据----------------");
                    System.out.println("Code=" + querySendDetailsResponse.getCode());
                    System.out.println("Message=" + querySendDetailsResponse.getMessage());
                    int i = 0;
                    for (QuerySendDetailsResponse.SmsSendDetailDTO smsSendDetailDTO : querySendDetailsResponse.getSmsSendDetailDTOs()) {
                        System.out.println("SmsSendDetailDTO[" + i + "]:");
                        System.out.println("Content=" + smsSendDetailDTO.getContent());
                        System.out.println("ErrCode=" + smsSendDetailDTO.getErrCode());
                        System.out.println("OutId=" + smsSendDetailDTO.getOutId());
                        System.out.println("PhoneNum=" + smsSendDetailDTO.getPhoneNum());
                        System.out.println("ReceiveDate=" + smsSendDetailDTO.getReceiveDate());
                        System.out.println("SendDate=" + smsSendDetailDTO.getSendDate());
                        System.out.println("SendStatus=" + smsSendDetailDTO.getSendStatus());
                        System.out.println("Template=" + smsSendDetailDTO.getTemplateCode());
                    }
                    System.out.println("TotalCount=" + querySendDetailsResponse.getTotalCount());
                    System.out.println("RequestId=" + querySendDetailsResponse.getRequestId());
                    String insertsql = "INSERT INTO `msg_send_info` ( `sender`, `customer_name`, `customer_phone`, `message_content`, `outpatient_name`, `is_success`) VALUES" +
                            "('" + ShiroKit.getUser().getAccount() + "', '" + cu.getCustomerName() + "', '" + cu.getCustomerPhone()
                            + "', '您好,参与活动的费用已返还，咿呀口腔，您身边的口腔健康专家。','" + ShiroKit.getUser().getOutpatientName() + "',1);";
                    sqlMapper.insert(insertsql);
                } else {
                    String insertsql = "INSERT INTO `msg_send_info` ( `sender`, `customer_name`, `customer_phone`, `message_content`,`outpatient_name`, `is_success`) VALUES" +
                            "('" + ShiroKit.getUser().getAccount() + "', '" + cu.getCustomerName() + "', '" + cu.getCustomerPhone()
                            + "', '您好,参与活动的费用已返还，咿呀口腔，您身边的口腔健康专家。','" + ShiroKit.getUser().getOutpatientName() + "',2);";
                    sqlMapper.insert(insertsql);
                }
            }
            String sqlup = "update reservemoney_activity set statuss='" + time.substring(5, 7) + "' ";
            sqlMapper.update(sqlup);  //当月存入数据
        }
    }


    //产品名称:云通信短信API产品,开发者无需替换
    static final String product = "Dysmsapi";
    //产品域名,开发者无需替换
    static final String domain = "dysmsapi.aliyuncs.com";

    // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
    static final String accessKeyId = "LTAIQMzfyJwlbjuU";

    static final String accessKeySecret = "8yCe7fywBbBkZbMS8dXkS2tZpELT6N";

    public static SendSmsResponse sendSms(SendSmsRequest request) throws ClientException {
        //可自助调整超时时间
        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
        //初始化acsClient,暂不支持region化
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
        IAcsClient acsClient = new DefaultAcsClient(profile);
        //hint 此处可能会抛出异常，注意catch
        SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
        return sendSmsResponse;
    }

    public static QuerySendDetailsResponse querySendDetails(String bizId) throws ClientException {
        //可自助调整超时时间
        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
        //初始化acsClient,暂不支持region化
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
        IAcsClient acsClient = new DefaultAcsClient(profile);
        //组装请求对象
        QuerySendDetailsRequest request = new QuerySendDetailsRequest();
        //必填-号码
        request.setPhoneNumber("18602744660");
        //可选-流水号
        request.setBizId(bizId);
        //必填-发送日期 支持30天内记录查询，格式yyyyMMdd
        SimpleDateFormat ft = new SimpleDateFormat("yyyyMMdd");
        request.setSendDate(ft.format(new Date()));
        //必填-页大小
        request.setPageSize(10L);
        //必填-当前页码从1开始计数
        request.setCurrentPage(1L);
        //hint 此处可能会抛出异常，注意catch
        QuerySendDetailsResponse querySendDetailsResponse = acsClient.getAcsResponse(request);
        return querySendDetailsResponse;
    }
}
